import { reqGetGoodsDetail } from "../../api/detail";

const state = {
	goods: {
		skuInfo: {
			skuImageList: []
		},
		categoryView: {},
		spuSaleAttrList: [ { spuSaleAttrValueList: [] } ]
	}
};

const getters = {};

const actions = {
	getGoodsDetail({ commit }, data) {
		reqGetGoodsDetail(data)
			.then((response) => {
				commit("GET_GOODS_DETAIL", response);
			})
			.catch((e) => {
				console.log(e);
			});
	}
};

const mutations = {
	GET_GOODS_DETAIL(state, data) {
		state.goods = data;
	}
};

export default {
	namespaced: true,
	state,
	getters,
	actions,
	mutations
};
